package me.chan.chatting.server.service;

import io.netty.channel.Channel;
import me.chan.chatting.server.model.Group;

import java.util.List;
import java.util.Set;

public interface GroupService {

    /**
     * @param name
     * @param members
     * @return
     */
    Group createGroup(String name, Set<String> members);

    /**
     * @param name
     * @param member
     * @return
     */
    Group joinMember(String name, String member);

    /**
     * @param name
     * @param member
     * @return
     */
    Group removeMember(String name, String member);

    /**
     * @param name
     * @return
     */
    Group removeGroup(String name);

    /**
     * @param name
     * @return
     */
    Set<String> getMembers(String name);

    /**
     * 获取组成员的 channel 集合, 只有在线的 channel 才会返回
     * @param groupName
     * @return  a set of channel of members
     */
    List<Channel> getMembersChannel(String groupName);
}
